<template>
	<view class="container">
		<mh-navbar :back="true" title="意见反馈" custom fixed center zIndex="1010" />
		<view style="padding: 0 32rpx;">
			<view class="feedbackConWrap">
				<textarea class="feedbackCon" placeholder="请在此输入您的宝贵意见，APP使用体验、优化建议都可以告诉我" placeholder-style="color:#999999" v-model="describe" />
			</view>
			<view class="zishu">您还能输入{{300-describe.length}}个字</view>
		</view>
		<view>
			<u-button style="width: 90%;" type="primary" @click="feedback">提交</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showModel:'',
				describe: '',
				canClick:true
			};
		},
		onLoad(e) {
		},
		methods:{
			feedback(){
				if(this.canClick){
					if(this.describe){
						this.canClick = false
						this.$u.api.feedback({content:this.describe}).then((res) => {
							if(res.code == 200){
								uni.showToast({
									title: '反馈成功，感谢您宝贵的意见建议！',
									icon: 'none',
									position: 'bottom',
									duration: 2000,
								});
								setTimeout(()=>{
									uni.navigateBack({
										delta:1
									})
								},2000)
							}
						}).catch(res=>{
							this.canClick = true
						})
					}else{
						uni.showToast({
							title: '您还没有输入内容哦~',
							icon: 'none',
							position: 'bottom',
							duration: 3000
						});
					}
				}
			},
		}
	}
</script>

<style>
	page{background: #EFF1F7;}
</style>
<style lang="scss" scoped>
	.container{
		.feedbackConWrap{background-color: #FFFFFF;border-radius: 20rpx;margin-top: 20rpx;
			.feedbackCon{width: 100%;height: 300rpx;padding: 20rpx 4rpx;font-size: 28rpx;}
		}
		.zishu{margin-top:24rpx;font-size: 28rpx;text-align: right;}
	}
</style>
